<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:TfsBuildManager.Views">

<DataTemplate xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" x:Key="HeaderTemplateArrowUp">
    <DockPanel>
        <TextBlock HorizontalAlignment="Center" Text="{Binding}"/>
        <Path x:Name="arrow"
           StrokeThickness = "1"
           Fill = "Gray"
           Data = "M 5,10 L 15,10 L 10,5 L 5,10"/>
    </DockPanel>
</DataTemplate>
<DataTemplate xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" x:Key="HeaderTemplateArrowDown">
    <DockPanel>
        <TextBlock HorizontalAlignment="Center" Text="{Binding}"/>
        <Path x:Name="arrow"
              StrokeThickness = "1"
              Fill = "Gray"
              Data = "M 5,5 L 10,10 L 15,5 L 5,5"/>
    </DockPanel>
</DataTemplate>
<DataTemplate xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" x:Key="HeaderTemplateTransparent">
    <DockPanel>
        <TextBlock HorizontalAlignment="Center" Text="{Binding}"/>
        <Path x:Name="arrow"
              StrokeThickness = "1"
              Fill = "Transparent"
              Data = "M 5,5 L 10,10 L 15,5 L 5,5"/>
    </DockPanel>
</DataTemplate>
<DataTemplate xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" x:Key="HeaderTemplateSimple">
    <Label HorizontalAlignment="Center" Content="{Binding}" Background="White" FontWeight="Bold"/>
</DataTemplate>

    <Style x:Key="MyListViewItemContainerStyle" TargetType="{x:Type ListViewItem}">
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="Padding" Value="0,1.5,0,1.5"/>
        <Setter Property="FontSize" Value="11"/>
        <Setter Property="Template" Value="{DynamicResource MyListViewItemContainerControlTemplate}"/>
        <Style.Triggers>
            <DataTrigger Binding="{Binding XPath=Read}" Value="false">
                <Setter Property="TextBlock.FontWeight" Value="Bold"/>
            </DataTrigger>
        </Style.Triggers>
    </Style>
    <ControlTemplate x:Key="MyListViewItemContainerControlTemplate" TargetType="{x:Type ListBoxItem}">
        <Border SnapsToDevicePixels="True" x:Name="Bd" Background="{TemplateBinding Background}" BorderBrush="{DynamicResource DefaultGradientBrush}" BorderThickness="0,0,0,0.5" Padding="{TemplateBinding Padding}">
            <GridViewRowPresenter/>
        </Border>
        <ControlTemplate.Triggers>
            <Trigger Property="IsSelected" Value="True">
                <Setter Property="Background" TargetName="Bd" Value="{DynamicResource MySelectedListItemBlueSolidBrush}"/>
                <Setter Property="BorderBrush" TargetName="Bd" Value="#FF000000"/>
                <Setter Property="BorderThickness" TargetName="Bd" Value="0.5,0.5,0.5,0.5"/>
                <Setter Property="Margin" TargetName="Bd" Value="0,-1,0,0"/>
            </Trigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsSelected" Value="True"/>
                    <Condition Property="Selector.IsSelectionActive" Value="False"/>
                </MultiTrigger.Conditions>
                <Setter Property="Background" TargetName="Bd" Value="{DynamicResource MyGraySolidBrush}"/>
                <Setter Property="BorderBrush" TargetName="Bd" Value="{DynamicResource MyBlueSolidBrush1}"/>
            </MultiTrigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

</ResourceDictionary>